package com.example.securityconfiggen.controller;

import com.example.securityconfiggen.config.TestConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/web")
@Slf4j
public class TestController {

    @Resource
    private TestConfiguration configuration;

    @Value("${spring.redis.password}")
    private String pwd;

    @Value("${db.password}")
    private String dbPwd;

    /**
     * feign接口测试--被调用
     */
    @GetMapping("/test1")
    public String test1() {
        return pwd;
    }

    /**
     * feign接口测试--被调用
     */
    @GetMapping("/test2")
    public String test2() {
        return configuration.getPassword();
    }

    @GetMapping("/test3")
    public String test3() {
        return this.dbPwd;
    }

}
